package com.tsmti.activiti.entity;

import com.tsmti.core.common.entity.ActBaseDataEntity;
import com.tsmti.core.common.entity.BaseDataEntity;
import org.hibernate.annotations.*;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Package：com.tsmti.activiti.entity
 * @Class：ExtendActModel
 * @Description： TODO
 * @Author：zcw
 * @Date：Created in 2018/7/30 12:20
 * @Company:
 * @Version：
 * @Modified By:
 */
@Entity
@Table(name="extend_act_model")
@DynamicUpdate()
@DynamicInsert()
@Where(clause = "delFlag = 0")
public class ExtendActModel extends ActBaseDataEntity<String> {
    private static final long serialVersionUID = 5521893895841661522L;

    /**主键ID*/
    private String id;
    /**流程ID*/
    private String workflowId;
    /**版本号*/
    private Integer actVersion;
    /**关联的 业务表 ID*/
    private String extendActBusinessId;
    /**activiti中的部署表id*/
    private String deploymentId;
    /**描述*/
    private String description;
    /**activiti中的模型表id*/
    private String modelId;
    /**名称*/
    private String name;
    /**发布状态 0:已发布 1：未发布*/
    private String status;
    /**业务名称*/
    private String businessName;
    /**
     * 流程key
     */
    private String actKey;
    /**
     * 流程定义id
     */
    private String defId;
    @Id
    @Override
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    public String getId() {
        return id;
    }

    @Override
    public void setId(String id) {
        this.id = id;
    }

    public Integer getActVersion() {
        return actVersion;
    }

    public void setActVersion(Integer actVersion) {
        this.actVersion = actVersion;
    }

    public String getExtendActBusinessId() {
        return extendActBusinessId;
    }

    public void setExtendActBusinessId(String extendActBusinessId) {
        this.extendActBusinessId = extendActBusinessId;
    }

    public String getDeploymentId() {
        return deploymentId;
    }

    public void setDeploymentId(String deploymentId) {
        this.deploymentId = deploymentId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getModelId() {
        return modelId;
    }

    public void setModelId(String modelId) {
        this.modelId = modelId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Formula(value = "(select f_t.name from extend_act_business f_t where f_t.id = extendActBusinessId)")
    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    @Transient
    public String getActKey() {
        return actKey;
    }

    public void setActKey(String actKey) {
        this.actKey = actKey;
    }

    @Override
    public String getStatus() {
        return status;
    }

    @Override
    public void setStatus(String status) {
        this.status = status;
    }

    public String getWorkflowId() {
        return workflowId;
    }

    public void setWorkflowId(String workflowId) {
        this.workflowId = workflowId;
    }

    @Override
    public String getDefId() {
        return defId;
    }

    @Override
    public void setDefId(String defId) {
        this.defId = defId;
    }
}
